import { getToken } from '@/utils'
// 登录功能，只需要存储 token 即可，所以，状态默认值为：''
// const initialState = localStorage.getItem('geek-pc-token') || ''

// 保存用户登录成功后的token
// const initialState = localStorage.getItem('geek-pc-token') || '';
const initialState = getToken()
export const login = (state = initialState, action) => {
  // 保存 token 到 reducer
  if (action.type === 'login/token') {
    return action.payload
  }
  return state
}
